/**
 * 
 */
package com.ifuntimes.utils;

import java.io.IOException;
import java.util.List;


import com.typesafe.config.Config;
/**
* @author YuHai E-mail:it@ifuntimes.com
* @version 创建时间：2017年9月5日 下午6:03:48
* 类说明
*/
/**
 * @author HH
 *
 */
public class ConfigHelper {
	
	private final Config config;
	public ConfigHelper(String config) throws IOException{
		this.config= new ConfigFilePath().createConfigObject(config);
	}
	 	 
	

	/**
	 * 
	 * @Title: getInteger
	 * @Description: get config integer
	 * @param name
	 * @return Integer
	 * @throws exception
	 */
	public Integer getInteger(String name) throws Exception {
		return config.getInt(name);
	}

	/**
	 * 
	 * @Title: getInteger
	 * @Description: get config string
	 * @param name
	 * @return Integer
	 * @throws exception
	 */
	public String getString(String name) throws Exception {
		return config.getString(name);
	}
	
	/**
	 * 
	 * @Title: getInteger
	 * @Description: get config bool
	 * @param name
	 * @return Integer
	 * @throws exception
	 */

	public Boolean getBoolen(String name) throws Exception {
		return config.getBoolean(name);
	}

	/**
	 * 
	 * @Title: getInteger
	 * @Description: get config Number
	 * @param name
	 * @return Integer
	 * @throws exception
	 */
	public Number getNumber(String name) throws Exception {
		return config.getNumber(name);
	}
	
	/**
	 * 
	 * @Title: getInteger
	 * @Description: get List string
	 * @param name
	 * @return Integer
	 * @throws exception
	 */
	public List<String> getStringList(String name) {
		return config.getStringList(name);
	}
	
	/**
	 * 
	 * @Title: getInteger
	 * @Description: get List T
	 * @param name
	 * @return Integer
	 * @throws exception
	 */
	public List<? extends Object> getList(String name){ 
		return config.getObjectList(name);
	}
}
